/**
  * @description: 订单列表中的店铺模块
  * @author: yingying.fan
  * @date: 2019/2/25 17:56
  */
import React from 'react'
import OrderStoreItem from '../orderlist/OrderStoreItem'
import OrderSkuItem from '../orderlist/OrderSkuItem'
import { StyleSheet } from 'react-native'
import { px2dp } from 'rn-xiaobu-utils'
import OrderOpBtnList from '../orderlist/OrderBtnList'

export default class DetailOrderStoreItem extends OrderStoreItem {

  _getSkuOpBtns = skuInfo => {
    let opBtnListView
    if (skuInfo.OP && skuInfo.OP.length > 0) {
      opBtnListView = (<OrderOpBtnList
        orderIndex={this.props.orderIndex}
        orderInfo={this.props.orderInfo}
      />)
    }
    return opBtnListView
    // return (
    //   <View style={styles.btnContainer}>
    //     {opBtnListView}
    //   </View>
    // )
  }

  _getSkuItem = (skuInfo, index, storeId) => {
    skuInfo.ORDER_ID = this.props.orderId
    let opBtnListView = null
    if (skuInfo.OP && skuInfo.OP.length > 0) {
      opBtnListView = (
        <View>
          <OrderOpBtnList
            key={storeId + 'op' + index}
            orderIndex={index}
            orderInfo={skuInfo}
          />
        </View>
      )
    }
    return [
      <OrderSkuItem
        key={storeId + 'sku' + index}
        skuInfo={skuInfo}/>,
      opBtnListView
    ]
  }
}

const styles = StyleSheet.create({
  btnContainer: {
    flexDirection: 'row',
    justifyContent: 'flex-end',
    alignItems: 'center',
    paddingTop: px2dp(20),
    borderStyle: 'solid',
    borderTopColor: '#dddddd',
    borderTopWidth: px2dp(1)
  }
})
